package com.guaoran.interview.in2018.thread.queue;

import java.util.concurrent.BlockingQueue;
import java.util.concurrent.LinkedBlockingQueue;
import java.util.concurrent.SynchronousQueue;

/**
 * @Author gucheng
 * @Description SynchronousQueue
 * 2019-04-09 11:09
 */
public class SynchronousQueueDemo {
    static BlockingQueue<Integer> blockingQueue = new SynchronousQueue<>();
    volatile static int count = 0;
    public static void main(String[] args) {
        for (int i = 0; i < 15; i++) {
            final int j = i;
            new Thread(()->{
                blockingQueue.add(count);
                System.out.println(j);
            }).start();
        }

    }
}
